<script setup lang="ts">
import { ref } from 'vue';
import Son from './components/Son.vue';
const money = ref(10000)
const add = (val: number) => {
    money.value += val
}

const reduce = (val: number) => {
    money.value -= val
}

/* 
    1. 父组件传递 money, add, reduce
    2. 子组件通过 defineEmits 接收方法， defineProps 接收 money
    3. emits调用父组件方法，传递参数回来
*/

</script>

<template>
    <h1>父组件</h1>
    <Son :money="money" @add="add" @reduce="reduce"></Son>
</template>

<style scoped>
</style>